<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>修改密码</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta http-equiv="Access-Control-Allow-Origin" content="*">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${ctx}/resources/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="${ctx}/resources/css/public.css" media="all" />
</head>
<body>
	<form class="layui-form layui-row changePwd" id="changePwdForm">
		<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
			<div class="layui-input-block layui-red pwdTips">请输入旧密码，新密码必须两次输入一致才能提交</div>
			<div class="layui-form-item">
				<label class="layui-form-label">用户名</label>
				<div class="layui-input-block">
					<input type="text" value="${user.loginname}" disabled class="layui-input layui-disabled">
					<input type="hidden" name="loginname" value="${user.loginname}">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">旧密码</label>
				<div class="layui-input-block">
					<input type="password" name="oldPwd" value="" placeholder="请输入旧密码" lay-verify="required" class="layui-input pwd">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">新密码</label>
				<div class="layui-input-block">
					<input type="password" name="newPwd" value="" placeholder="请输入新密码" lay-verify="required" class="layui-input pwd">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button type="button" class="layui-btn" id="doSubmit">立即修改</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</div>
	</form>
	
	<script src="${ctx }/resources/layui/layui.js"></script>
	<script type="text/javascript">
	layui.use([ 'element', 'jquery', 'layer', 'form' ], function() {
		var $ = layui.jquery;
		var element = layui.element;
		var layer = layui.layer;
		var form = layui.form;
		
		$("#doSubmit").click(function() {
			layer.confirm('你真的要修改密码吗?', {icon: 3, title:'提示'}, function(index){
				var params = $("#changePwdForm").serialize();
				$.post("${ctx}/user/changePwd.action",params,function(res){
					layer.msg(res.msg);
					$("#changePwdForm")[0].reset();
				})
				layer.close(index);
			});
		});
	})
	</script>
</body>
</html>